-
Notifications
You must be signed in to change notification settings - Fork 71
Add package-private extension type Event on FileSystemEvent. #2196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Package publishing
Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. |
696a962
to
6ef3705
Compare
PR HealthBreaking changes ✔️
This check can be disabled by tagging the PR with
Coverage
|
File | Coverage |
---|---|
pkgs/watcher/lib/src/directory_watcher/linux.dart | 💔 91 % ⬇️ 1 % |
pkgs/watcher/lib/src/directory_watcher/mac_os.dart | 💔 0 % ⬇️ NaN % |
pkgs/watcher/lib/src/directory_watcher/windows.dart | 💔 0 % ⬇️ NaN % |
pkgs/watcher/lib/src/event.dart | 💚 58 % |
pkgs/watcher/lib/src/file_watcher/native.dart | 💚 83 % ⬆️ 3 % |
pkgs/watcher/lib/src/utils.dart | 💚 83 % |
This check for test coverage is informational (issues shown here will not fail the PR).
This check can be disabled by tagging the PR with skip-coverage-check
.
API leaks ✔️
The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
Package | Leaked API symbol | Leaking sources |
---|
This check can be disabled by tagging the PR with skip-leaking-check
.
License Headers ✔️
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files |
---|
no missing headers |
All source files should start with a license header.
Unrelated files missing license headers
Files |
---|
pkgs/bazel_worker/benchmark/benchmark.dart |
pkgs/benchmark_harness/integration_test/perf_benchmark_test.dart |
pkgs/boolean_selector/example/example.dart |
pkgs/clock/lib/clock.dart |
pkgs/clock/lib/src/clock.dart |
pkgs/clock/lib/src/default.dart |
pkgs/clock/lib/src/stopwatch.dart |
pkgs/clock/lib/src/utils.dart |
pkgs/clock/test/clock_test.dart |
pkgs/clock/test/default_test.dart |
pkgs/clock/test/stopwatch_test.dart |
pkgs/clock/test/utils.dart |
pkgs/coverage/lib/src/coverage_options.dart |
pkgs/html/example/main.dart |
pkgs/html/lib/dom.dart |
pkgs/html/lib/dom_parsing.dart |
pkgs/html/lib/html_escape.dart |
pkgs/html/lib/parser.dart |
pkgs/html/lib/src/constants.dart |
pkgs/html/lib/src/encoding_parser.dart |
pkgs/html/lib/src/html_input_stream.dart |
pkgs/html/lib/src/list_proxy.dart |
pkgs/html/lib/src/query_selector.dart |
pkgs/html/lib/src/token.dart |
pkgs/html/lib/src/tokenizer.dart |
pkgs/html/lib/src/treebuilder.dart |
pkgs/html/lib/src/utils.dart |
pkgs/html/test/dom_test.dart |
pkgs/html/test/parser_feature_test.dart |
pkgs/html/test/parser_test.dart |
pkgs/html/test/query_selector_test.dart |
pkgs/html/test/selectors/level1_baseline_test.dart |
pkgs/html/test/selectors/level1_lib.dart |
pkgs/html/test/selectors/selectors.dart |
pkgs/html/test/support.dart |
pkgs/html/test/tokenizer_test.dart |
pkgs/html/test/trie_test.dart |
pkgs/html/tool/generate_trie.dart |
pkgs/pubspec_parse/test/git_uri_test.dart |
pkgs/stack_trace/example/example.dart |
pkgs/watcher/test/custom_watcher_factory_test.dart |
pkgs/yaml_edit/example/example.dart |
This check can be disabled by tagging the PR with skip-license-check
.
db92c9b
to
8e6e625
Compare
8e6e625
to
ada967c
Compare
ada967c
to
e79280c
Compare
286081e
to
6d4b5c3
Compare
3898a07
to
246ce10
Compare
0049941
to
61995a9
Compare
61995a9
to
83a4c8a
Compare
The SDK
FileSystemEvent
type is confusing in how it handlesisDirectory
: for theFileSystemDeleteEvent
subclass it always returnsfalse
, even if you explicitly passtrue
to the constructor. Some watcher code is currently passingtrue
to the constructor as if it will do something.So while it initially looks like there are eight types of event (create file, create directory, modify file, modify directory, remove file, remove directory, move file, move directory) there are actually only seven.
Create an extension type around FileSystemEvent that makes this clear, use it everywhere. Use an event type enum with seven entries instead of four entries + a boolean, so as not to have to deal with the unrepresentable "delete directory".
No behavior changes :)
Other cleanup:
Simplify
_canonicalEvent
, removes don't specifyisDirectory
so those always conflict, it's only file add and file modify that can be reduced to a single "create" event.MacOS watcher never receives move events or "modify directory" events from the OS, make this clear: assert(false) and drop the event if such an event is received, so tests will catch it and if it happens in the wild we use the code tested with no such events.
Clean up MacOS watcher
_sortEvents
because it can't receive directory move or "modify directory".Windows watcher only gets a "modify directory" event from the OS alongside "directory created" or "directory deleted", and was being ignored: make it clearer that it's ignored by ignoring sooner.
Update doc for Windows
_sortEvents
which says it removes "move" events, it does not(!).